// const baseUrl = 'http://192.168.0.195:8088'
const baseUrl = 'http://112.74.55.150:8086'
// const baseUrl = 'http://xy-stone.vip:8086'
// const baseUrl = 'http://localhost:8086'
				
function request({path, method, data, header, contentType, processData}) {
	const url = baseUrl + path;
	
	return new Promise((resovle, reject) => {
		uni.request({
			url: url,
			data: data,
			method: method,
			header: header,
			
			contentType: contentType,
			processData: processData,
			
			success: (res) => {
				resovle(res.data)
				console.log(res)
			},
			error: (err) => {
				uni.showToast({
				    title: '网络错误',
				    duration: 1000
				});
				reject(err)
			}
		})
	})
	
}

export function get(path, data = {}) {
	return request({path, data,method: "GET"});
}

export function post(path, data = {}) {
	return request({path, data, method: "POST", header: {
						"content-type": "application/json;charset=UTF-8",
					}});
}
